#include <iostream>
#include <string>
using namespace std;

// 类模版
template<class NameType,class AgeType>
class Person
{
public:
    NameType name;
    AgeType age;

    Person(NameType name, AgeType age)
    {
        this->name = name;
        this->age = age;
    }

    void show();
};

//如果一个类模版中的成员方法，需要在类外定义 -- 则需要参照函数模版的定义
template <class NameType,class AgeType>
void Person<NameType, AgeType>::show() {
    cout << "name = " << name << endl;
    cout << "age = " << age << endl;

}

void test1()
{
    Person<string, int> p1("孙悟空",999);
    p1.show();
}
int main()
{
    test1();
    return 0;
}